package com.gitee.wsgalaxy.gnodroid;

import android.support.test.runner.AndroidJUnit4;
import android.util.Log;

import com.gitee.wsgalaxy.gnodroid.connect.GndMessage;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
 * Created by wsgalaxy on 3/18/18.
 */

@RunWith(AndroidJUnit4.class)
public class GndMessageTest {

    GndMessage message = new GndMessage();
    byte[] bytes = null;

    @BeforeClass
    public static void beforeClass()
    {}

    @Before
    public void before() throws Exception
    {
        boolean result;
        result = message.addData("abcdefghijklmn".getBytes());
        result = message.addData("阿斯顿法国红军看来".getBytes("UTF-8"));
        result = message.addData("1234567890".getBytes());
        bytes = message.generateBytes();
    }


    @Test
    public void testGenerateBytes() throws Exception
    {

        Log.d("gndtest", new String(bytes, "UTF-8"));
        assertEquals(1, 1);

    }

    @Test
    public void testGenerateMessage() throws Exception
    {
        GndMessage gndMessage = GndMessage.generateMessage(bytes, bytes.length);

        for (GndMessage.GndMessageData d : gndMessage.message_data_list) {
            Log.d("gndtest", new String(d.data, "UTF-8"));
        }

        assertEquals(1, 1);
    }

    @After
    public void after()
    {}

    @After
    public void afterClass()
    {}

}
